package com.zimin.cloud.web.controller.system;

import com.zimin.cloud.mine.pojo.system.business.PostBO;
import com.zimin.cloud.system.api.IPostFeign;
import com.zimin.shared.pojo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import reactor.core.publisher.Mono;

import java.util.List;

/**
 * @author zimin
 * @since 2022/1/29 5:22 下午
 */
@RestController
@RequestMapping("/web/system/post/api")
public class WebPostController {


    @Autowired
    private IPostFeign postFeign;

    @GetMapping
    public Mono<Result> postList(PostBO postBO) {
        return Mono.just(postFeign.postPageList(postBO));
    }

    @GetMapping("allPost")
    public Mono<Result> allPost(){
        return Mono.just(postFeign.allPost());
    }

    @PostMapping
    public Mono<Result> save(@RequestBody PostBO postBO) {
        return Mono.just(postFeign.save(postBO));
    }

    @PutMapping
    public Mono<Result> update(@RequestBody PostBO postBO) {
        return Mono.just(postFeign.update(postBO));
    }

    @DeleteMapping
    public Mono<Result> delete(@RequestParam(value = "idList") List<String> idList) {
        return Mono.just(postFeign.delete(idList));
    }

}
